capture log close
clear all
macro drop _all
set more off
version 14
set matsize 800 

//  #0:  setup

import excel "API_IT.CEL.SETS.P2_DS2_en_excel_v2.xls", sheet("Data") firstrow

foreach var of varlist _all {
        local label : variable label `var'
        local new_name = lower(strtoname("`label'"))
        rename `var' `new_name'
}

 rename (_*) (y*)
 
 keep if country_name=="Uganda" | country_name=="Sub-Saharan Africa"
 gen id = _n
 
 reshape long y, i(id) j(year)
 replace y=0 if y==. & year<1990

************************
* FIGURE 1 in paper
************************
 
 # delimit ;
 tw lowess y year if id==1 & year>1984, lw(thick) || lowess y year if id==2 & year>1984,  lp(dash) lw(thick)
 xscale(r(1985 2015)) xlabel(1985(5)2015) xtitle("") ytitle("(per 100 people)", size(2.5)) 
 title("Mobile cellular subscriptions", size(3)) legend(pos(10) ring(0) col(2) lab(1 "sub-Saharan Africa") lab(2 "Uganda") stack); 
 #delimit cr

exit